
package com.yimixian.app.fragment;

import com.yimixian.app.R;
import com.yimixian.app.ui.MessageDialogView;

import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;

/**
 * 用来显示Dialog的BaseFragment Created by songzhiyang on 2015/8/21.
 */
public class DialogFragment extends Fragment{
    protected ViewGroup mDialogView;

    protected void showCountLimitDialog() {
        final MessageDialogView messageDialogView = new MessageDialogView(getActivity());
        messageDialogView.bind(getString(R.string.confirm), "亲，每次只支持换购一个品，数量有限，先到先得哦！",
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mDialogView.removeView(messageDialogView);
                }
            });
        mDialogView.addView(messageDialogView);
    }

    protected void showMoneyLimitDialog(float price) {
        final MessageDialogView messageDialogView = new MessageDialogView(getActivity());
        messageDialogView.bind(getString(R.string.confirm), "选购满 "
                + price + "元就可以点击换购此品啦！数量有限，快快抢购吧！",
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mDialogView.removeView(messageDialogView);
                }
            });
        mDialogView.addView(messageDialogView);
    }


    public void setDialogView(ViewGroup viewGroup) {
        mDialogView = viewGroup;
    }
}
